Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Hidden] Fix js/css implementation inconsistency #9450

Merged

Conversation

oliviertassinari
Copy link
Member

@oliviertassinari oliviertassinari commented Dec 9, 2017

js

import withWidth, { isWidthDown } from 'material-ui/utils/withWidth';

function HiddenJs(props: Props) {
  const {
    children,
    width,
    ...other
  } = props;

  if (isWidthDown('md', width)) {
    return null
  }

  return children;
}

export default withWidth()(HiddenJs);

css

const styles = theme => ({
  root: {
    [theme.breakpoints.down('md')]: {
      backgroundColor: 'blue',
    },
  },
});

Closes #9405

Breaking change

This change is making the js and css breakpoint utils behaving the same way.
The default parameter of withWidth.isWidthDown(breakpoint, width, inclusive) changed:

-inclusive = true
+inclusive = false

You might want to update the usage of the API by increasing the breakpoing used on the Hidden component:

-<Hidden implementation="js" mdDown>
+<Hidden implementation="js" lgDown>

Or by going back to the previous behavior:

-isWidthDown(breakpoint, width)
+isWidthDown(breakpoint, width, true)

@oliviertassinari oliviertassinari added breaking change component: Hidden The React component. bug 🐛 Something doesn't work labels Dec 9, 2017
@oliviertassinari oliviertassinari merged commit 28c1f7a into mui:v1-beta Dec 9, 2017
@oliviertassinari oliviertassinari deleted the hidden-fix-isWidthDown branch December 9, 2017 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change bug 🐛 Something doesn't work component: Hidden The React component.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant